const HOUSE_LIST = [
	{
		name: '无',
		value: 0,
	},
	{
		name: '有房有贷款',
		value: 1,
	},
	{
		name: '1套全款房',
		value: 2,
	},
	{
		name: '2套房及以上',
		value: 3
	},
]


export const getHouseList = ({ hasEmpty = true } = {}) => {
  const houseList = [...HOUSE_LIST];
  if (hasEmpty) {
    houseList.push({
			name: '不限',
			value: null,
		})
  }

  return houseList
}

export const getHouseByIndex = ({ hasEmpty = true, index } = {}) => {
	if (!Number.isInteger(index)) {
		return {
			name: "",
			value: null
		}
	}

  const houseList = getHouseList({ hasEmpty });

	const value = houseList[index];
	return value
}

export const getHouseByValue = ({ value } = {}) => {
	return HOUSE_LIST.find(item => item.value === value) || {}
}